﻿<Page
    x:Class="TelemetryMobileService.MainPage"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TelemetryMobileService"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="White">

        <Grid Margin="50,50,10,10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Grid Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,0,20">
                <StackPanel>
                    <TextBlock Foreground="#0094ff" FontFamily="Segoe UI Light" Margin="0,0,0,6">MICROSOFT AZURE MOBILE SERVICES</TextBlock>
                    <TextBlock Foreground="Gray" FontFamily="Segoe UI Light" FontSize="45" >Sensor Mobile Service</TextBlock>
                </StackPanel>
            </Grid>


            <Grid Grid.Row="1">
                <StackPanel>

                    <local:QuickStartTask Number="1" Title="Insert a telemetry data" Description="Enter a sensor and its value and click Save to insert a new  entry into the Telemetry database" />

                    <StackPanel Orientation="Horizontal" Margin="72,0,0,0">
                        <TextBlock VerticalAlignment="Center">Sensor: </TextBlock>
                        <TextBox x:Name="SensorInput" Margin="5" MinWidth="300" VerticalAlignment="Center"/>
                        <TextBlock VerticalAlignment="Center">Value: </TextBlock>
                        <TextBox x:Name="ValueInput" Margin="5" MinWidth="75" VerticalAlignment="Center" InputScope="Number"/>
                        <Button x:Name="ButtonSave" Click="ButtonSave_Click" IsEnabled="False" Content="Save"/>
                    </StackPanel>

                </StackPanel>
            </Grid>

            <Grid Grid.Row="1" Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="60" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <StackPanel>
                    <local:QuickStartTask Number="2" Title="Query and Update Data" Description="Click refresh below to load the current active data from the Telemeetry database. Use the checkbox to tag a datum as stale and update the database" />
                    <Button Margin="72,0,0,0" Name="ButtonRefresh" Click="ButtonRefresh_Click">Refresh</Button>
                </StackPanel>
                <Grid Grid.Row="1" Margin ="62,10,0,0" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="60"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <!--ColumnDefinition Width="50"/ -->
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition Width="100"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Name="IdTextBlockH" Text="Id" VerticalAlignment="Center" TextAlignment="Left" Width="50" FontSize="18" />
                    <TextBlock Grid.Column="1" Name="SensorTextblockH" Text="Sensor" VerticalAlignment="Center" FontSize="18"  />
                    <TextBlock Grid.Column="2" Name="ValueTextBlockH" Text="Value" VerticalAlignment="Center" TextAlignment="Center" Width="100" FontSize="18" />
                </Grid>


                <ListView Name="ListItems" Margin="62,10,0,0" Grid.Row="2">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <!-- ColumnDefinition Width="50"/ -->
                                    <ColumnDefinition Width="50"/>
                                    <ColumnDefinition Width="125"/>
                                    <ColumnDefinition Width="100"/>
                                </Grid.ColumnDefinitions>
                                <!-- CheckBox  Grid.Column="0" Name="CheckBoxComplete" IsChecked="{Binding Complete, Mode=TwoWay}" Checked="CheckBoxComplete_Checked" Content=""  Margin="10,5" VerticalAlignment="Center"/ -->
                                <TextBlock Grid.Column="0"  x:Name="IdTextblock" Text="{Binding Id}" VerticalAlignment="Center"  />
                                <TextBlock Grid.Column="1"  x:Name="SensorTextblock" Text="{Binding Sensor}" VerticalAlignment="Center"  />
                                <TextBlock Grid.Column="2" x:Name="ValueTextBlock" Text="{Binding Value}" VerticalAlignment="Center" TextAlignment="Right" Width="100" />
                            </Grid>
                            <!--<StackPanel Orientation="Horizontal">
                                <CheckBox Name="CheckBoxComplete" IsChecked="{Binding Complete, Mode=TwoWay}" Checked="CheckBoxComplete_Checked" Content=""  Margin="10,5" VerticalAlignment="Center"/>
                                <TextBlock VerticalAlignment="Center">Sensor: </TextBlock>
                                <TextBlock x:Name="SensorTextblock" Text="{Binding Sensor}" VerticalAlignment="Center"  />
                                <TextBlock VerticalAlignment="Center">Value: </TextBlock>
                                <TextBlock x:Name="ValueTextBlock" Text="{Binding Value}" VerticalAlignment="Center"  />
                            </StackPanel>-->
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>

            </Grid>

        </Grid>
    </Grid>
</Page>
